Skip to content

Require time core extensions in all environments #39059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2020

Conversation

eugeneius
Copy link
Member

These have been required in the generated test environment config since 1c7207a, but the generated development config also uses them (albeit inside a conditional):

...and the generated production config contains a comment which uses them:

# config.active_record.database_selector = { delay: 2.seconds }

More generally, we shouldn't require core extensions in one environment and not others, since applications with config.active_support.bare enabled could rely on them implicitly and exhibit inconsistent behaviour across environments.

Somewhat incidentally closes #37391.

These have been required in the generated test environment config since
1c7207a, but the generated development
config also uses them (albeit inside a conditional), and the generated
production config contains a comment which uses them.

More generally, we shouldn't require core extensions in one environment
and not others, since applications with `config.active_support.bare`
enabled could rely on them implicitly and exhibit inconsistent behaviour
across environments.
@rails-bot rails-bot bot added the railties label Apr 26, 2020
@fxn
Copy link
Member

fxn commented Apr 26, 2020

Good catch.

@fxn fxn merged commit 1ed819e into rails:master Apr 26, 2020
thomasleese added a commit to alphagov/service-manual-frontend that referenced this pull request Feb 26, 2021
This is part of upgrading to Rails 6.1 and matches the change upstream: rails/rails#39059
edwardkerry pushed a commit to alphagov/service-manual-frontend that referenced this pull request Jun 23, 2021
This is part of upgrading to Rails 6.1 and matches the change upstream: rails/rails#39059
@jasonkarns
Copy link
Contributor

jasonkarns commented Apr 8, 2024

I know I'm late to this, but is there a reason this require isn't moved to config/application.rb if it's intended to be loaded for all environments?

(I've moved this require to config/application in one rails app after another, particularly after custom environments get created and forget to add the require. So I finally git-blamed the line to get here looking for more context 😄 )

@fxn
Copy link
Member

fxn commented Apr 8, 2024

Locality.

This happens to be a dependency of these particular files because they use the extension. It is a local thing, perhaps your staging.rb won't need it.

Even if it happens to be used by the three of them, that is not enough justification to take the require out of context.

@jasonkarns
Copy link
Contributor

That's fair, thanks @fxn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rails 6.1 development.rb undefined method `year' for 1:Integer
3 participants